dom0-build: fix build with clang5
authorJan Beulich <jbeulich@suse.com>
Wed, 12 Feb 2020 09:52:20 +0000 (10:52 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 12 Feb 2020 09:52:20 +0000 (10:52 +0100)
commit6827bea2b3b99153821b8b7446bdced27f720188
tree24b4a7748685c300482d1f4979825041d69438cc
parent1b3cec69bf300e012a0269f0a4f28cca1ebf22c9
dom0-build: fix build with clang5

With non-empty CONFIG_DOM0_MEM clang5 produces

dom0_build.c:344:24: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
                       ^  ~~~~~~~~~~~~~~~~~~
dom0_build.c:344:24: note: use '&' for a bitwise operation
    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
                       ^~
                       &
dom0_build.c:344:24: note: remove constant to silence this warning
    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
                      ~^~~~~~~~~~~~~~~~~~~~~
1 error generated.

Obviously neither of the two suggestions are an option here. Oddly
enough swapping the operands of the && helps, while e.g. casting or
parenthesizing doesn't. Another workable variant looks to be the use of
!! on the constant.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien@xen.org>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/arm/domain_build.c
xen/arch/x86/dom0_build.c